var app = getApp();
var ApiUrl = app.globalData.ApiUrl;
Page({

  /**
   * 页面的初始数据
   */
  data: {
  
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    wx.showLoading({
      title:"物流信息读取中...",      
    });
      var that = this;
      var key = wx.getStorageSync("key");
      var order_id = options.order_id;
      wx.request({
        url: ApiUrl + "/index.php?act=member_order&op=search_deliver",
        data: { "key": key, "order_id": order_id },
        header: {'content-type':'application/x-www-form-urlencoded'},
        method: 'post',         
        success: function (result) {
            if(!result.data.datas){
                that.setData({
                  err:'暂无物流信息'                   
                });
            }else{            
              var deliver = result.data.datas.deliver_info; 
              var deliverArray = new Array();
              
              for(var i=0;i<deliver.length;i++){
                　deliverArray[i] = deliver[i].split("&nbsp;").join(" ");                  
              }            
              that.setData({
                  deliver_info: deliverArray,
                  express_name: result.data.datas.express_name,
                  shipping_code: result.data.datas.shipping_code
              });
            }
        }
      })
      setTimeout(function () {
      wx.hideLoading();
      }, 2000)
  },
})